package com.libra.assemble.xutil.email;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.persistence.Transient;
import java.io.InputStream;

/**
 * 附件信息.
 * Created by Libra on 15/9/6.
 */
public class AttachmentForm {

    /** 文件名　 */
    private String FileName;

    /** 磁盘文件名 */
    private String diskFileName;

    /** 物理地址 */
    private String physicsPath;

    /** 访问地址 */
    private String visitPath;

    /** 文件大小 */
    private Integer filesize;

    /** 文件类型 */
    private String contentType;

    /** 文件流 */
    private InputStream inputStream;

    public String getFileName() {
        return FileName;
    }

    public void setFileName(String fileName) {
        FileName = fileName;
    }

    public String getDiskFileName() {
        return diskFileName;
    }

    public void setDiskFileName(String diskFileName) {
        this.diskFileName = diskFileName;
    }

    public String getPhysicsPath() {
        return physicsPath;
    }

    public void setPhysicsPath(String physicsPath) {
        this.physicsPath = physicsPath;
    }

    public String getVisitPath() {
        return visitPath;
    }

    public void setVisitPath(String visitPath) {
        this.visitPath = visitPath;
    }

    public Integer getFilesize() {
        return filesize;
    }

    public void setFilesize(Integer filesize) {
        this.filesize = filesize;
    }

    public String getContentType() {
        return contentType;
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    }

    /**
     * 不持久化到数据库，也不在Json中关联显示的属性.
     */
    @Transient
    @JsonIgnore
    public InputStream getInputStream() {
        return inputStream;
    }

    public void setInputStream(InputStream inputStream) {
        this.inputStream = inputStream;
    }

    /**
     * 覆盖toString方法，目的显示所有JavaBean的属性值，省略写很多的getXxx的方法
     */
    public String toString() {
        return ToStringBuilder.reflectionToString(this,
                ToStringStyle.MULTI_LINE_STYLE);
    }
}
